#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;
const int MOD = 10007;

int a, b, k, n, m;
int c[N][N];
void init() {
  rep(i, 0, k) c[i][0] = 1;
  rep(i, 1, k) rep(j, 1, i) c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
}
ll fastpow(ll b, ll p, ll mod) {
  ll res = 1;
  while (p) {
    if (p & 1) res = res * b % mod;
    b = b * b % mod;
    p >>= 1;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> a >> b >> k >> n >> m;
  init();
  ll ans = fastpow(a, n, MOD) * fastpow(b, m, MOD) % MOD * c[k][n] % MOD;
  cout << ans;
  return 0;
}